home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Magazin: Amiga-CD 1996 November & December
/
Amiga-CD 1996 #11-12.iso
/
pd-disketten
/
ungepackt
/
8_95
/
apd-8-95-2
/
psion
/
developer
/
source
/
ncplib
/
openncp.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-01-22
|
1KB
|
64 lines
/*
** SAS/C 6.51 constructor for opening
** "ncp.library"
**
** $VER: ncp.lib 1.1
**/
#include <constructor.h>
#define __USE_SYSBASE
#include <proto/exec.h>
#include <exec/execbase.h>
#include <proto/intuition.h>
#include <proto/dos.h>
#include <libraries/ncplib.h>
#include <string.h>
struct Library *NCPBase;
static struct Library *libbase;
CONSTRUCTOR_P(ncplib,500)
{
struct EasyStruct eas;
char buffer[ 128 ];
struct Task *pr = FindTask( NULL );
if( SysBase->LibNode.lib_Version < 37 )
return( 1 );
FOREVER
{
libbase = OpenLibrary( NCP_NAME, NCP_VERSION );
if( !libbase )
libbase = OpenLibrary( "PROGDIR:" NCP_NAME, NCP_VERSION );
if( !libbase )
libbase = OpenLibrary( "PROGDIR:Libs/" NCP_NAME, NCP_VERSION );
if( libbase )
{
NCPBase = libbase;
return( 0 );
}
eas.es_StructSize = sizeof( eas );
eas.es_Flags = 0;
eas.es_Title = buffer;
strncpy( buffer, pr->tc_Node.ln_Name, 127 );
if( Cli() )
GetProgramName( buffer, 127 );
buffer[ 127 ] = 0;
eas.es_TextFormat = "Requires V%ld (or higher))\nof \"" NCP_NAME "\"";
eas.es_GadgetFormat = "Retry|Cancel";
if( !EasyRequest( NULL, &eas, NULL, NCP_VERSION ) )
return( 1 );
}
}
DESTRUCTOR_P(ncplib,500)
{
if (libbase)
{
CloseLibrary((struct Library *)libbase);
libbase = NCPBase = NULL;
}
}